<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="sp" uri="http://www.springframework.org/tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>My JSP 'add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
<meta http-equiv="description" content="This is my page" />
<link rel="stylesheet" type="text/css" href="/css/reset.css" />
<link rel="stylesheet" type="text/css" href="/css/common.css" />
<script type="text/javascript" src="/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/js/formcheck/formcheck-0.0.1.js"></script>

</head>

<body class="mainframe">
  <c:if test="${menu.lev == 0 }">
    <a id="root_menu_add" class="button01" href="/admin/menu/add.dhtml?menu.parentId=${menu.id }" target="_self">添加下级菜单</a>
  </c:if>
  <form id="menuForm" action="/admin/menu/edit.dhtml" method="post">
    <input type="hidden" name="menu.id" value="<c:out value="${menu.id }" />" />
    <table class="admin_table">
      <caption>编辑菜单</caption>
      <c:if test="${message.info != null }">
        <tr>
          <td colspan="2"><sp:message code="${message.info}" text="" /></td>
        </tr>
      </c:if>
      <tr>
        <td>名称</td>
        <td><input id="menuName" type="text" name="menu.name" value="<c:out value="${menu.name }" />" /><span id="menuNameTip"></span></td>
      </tr>
      <tr>
        <td>描述</td>
        <td><input type="text" name="menu.note" value="<c:out value="${menu.note }" />" /></td>
      </tr>
      <tr>
        <td>链接</td>
        <td><input id="menuUrl" type="text" name="menu.url" value="<c:out value="${menu.url }" />" /><span id="menuUrlTip"></span></td>
      </tr>
      <tr>
        <td>目标</td>
        <td><input type="text" name="menu.target" value="<c:out value="${menu.target }" />" /></td>
      </tr>
      <tr>
        <td>排序</td>
        <td><input type="text" name="menu.sort" value="<c:out value="${menu.sort }" />" /></td>
      </tr>
      <tr>
        <td></td>
        <td><input type="submit" class="button01" id="submit_menu" value="修改" /></td>
      </tr>
    </table>
  </form>

  <script type="text/javascript">
		window.parent.loadMenuTree();
		$(document).ready(function() {
		});
		$(document).ready(function() {
			// 表单验证
			var formCheck = $.formCheck();
			formCheck.regAllEmpty("menuName", {
				onShow : "输入目录名称",
				onFocus : "此项为必填",
				onError : "此项为必填",
				onCorrect : "目录名称输入正确"
			}, true);
			formCheck.regAllEmpty("menuUrl", {
				onShow : "输入链接",
				onFocus : "此项为必填",
				onError : "此项为必填",
				onCorrect : "链接输入正确"
			}, true);
			formCheck.formCheck("menuForm");
		});
	</script>
</body>
</html>